from config import BASE_URL
from page.page_limit_application import LimitApplicationPage
from page.page_login import LoginPage
from script import log
from tools import DriverTools


class TestLimit(object):

    def setup_method(self):
        # 获取driver
        driver = DriverTools.get_driver()
        # 输入网址
        driver.get(BASE_URL + "/common/member/login")
        # 创建对象
        self.login_page = LoginPage(driver)
        self.limit_app = LimitApplicationPage(driver)
        # 登录成功
        self.login_page.login("13800000001", "Aa123456")

    def teardown_method(self):
        DriverTools.quit_driver()

    def test01_limit_app_success(self):
        # 调用方法
        self.limit_app.limit_application(1000, "测试", "8888")
        # 打印结果
        result = self.limit_app.get_success_result()
        # print(result)
        log.info(f"执行结果：{result}")
        # 断言结果
        assert '1,000.00' in result
        # 截图
        self.limit_app.get_shot("limit_app_success.png")

    def test02_limit_app_fail(self):
        # 调用方法
        # 打印结果
        pass